/**
 * 任务总览数据模型
 */

/**
 * 任务状态类型
 */
export type TaskStatus = 'todo' | 'inProgress' | 'done';

/**
 * 任务需求类型
 */
export type TaskType = '业务需求' | '科技专项';

/**
 * 业务需求子类型
 */
export type BusinessSubType = '业务自驱型' | '平台赋能型' | '联合攻坚型';

/**
 * 科技专项子类型
 */
export type TechSubType = '个人效能提升' | '公共工具建设' | '数字员工建设';

/**
 * 任务子类型
 */
export type TaskSubType = BusinessSubType | TechSubType;

/**
 * 任务总览数据接口
 */
export interface TaskOverview {
  id: string | number;
  title: string;
  titleIndex?: string;
  taskType: TaskType;
  taskSubType: TaskSubType;
  busiDepartment?: string;
  busiGoal?: string;
  itDepartment?: string;
  lastWeekStatus?: TaskStatus;
  currentStatus: TaskStatus;
  isNewProject: boolean;
  isNewlyCompleted: boolean;
  originalPlan?: string;
  actualProgress?: string;
  pendingIssues?: string;
  newIssues?: string;
  nextWeekPlan?: string;
  processor?: string;
}

/**
 * 任务总览查询参数
 */
export interface TaskOverviewQueryParams {
  period?: string;
  taskType?: TaskType;
  taskSubType?: TaskSubType;
  busiDepartment?: string;
  itDepartment?: string;
  processor?: string;
}

/**
 * 任务编辑表单数据
 */
export interface TaskEditFormData {
  id: string | number;
  taskType: TaskType;
  taskSubType: TaskSubType;
  busiDepartment?: string;
  busiGoal?: string;
  itDepartment?: string;
  actualProgress?: string;
  newIssues?: string;
  nextWeekPlan?: string;
}

/**
 * 所有任务类型
 */
export const taskTypes: TaskType[] = ['业务需求', '科技专项'];

/**
 * 根据任务类型获取子类型选项
 * 
 * @param type 任务类型
 * @returns 子类型选项列表
 */
export const getSubTypesByType = (type?: TaskType): TaskSubType[] => {
  if (type === '业务需求') {
    return ['业务自驱型', '平台赋能型', '联合攻坚型'];
  } else if (type === '科技专项') {
    return ['个人效能提升', '公共工具建设', '数字员工建设'];
  }
  return [];
};
